<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>

    </h:head>
    <h:body>
        <ui:composition template="/template.xhtml">
             <ui:define name="title">
             Входящие сообщения
         </ui:define>
            <ui:define name="content">
                 <c:if test="#{userBean.curentUser == null}">
                    Вы не авторизировались. Авторизируйтесь!
                </c:if> 
                 <c:if test="#{userBean.curentUser != null}">
                    <h:dataTable  headerClass="table-header" rowClasses="table-row" value="#{userBean.newUserMessage}" var="o" >
                        <h:column>
                            <f:facet name="header">Autor</f:facet>
                            #{o.idUserFrom.name} 
                        </h:column>
                        <h:column>
                            <f:facet name="header">date</f:facet>
                            #{o.dateTime.toGMTString()}
                        </h:column>
                  
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:form>
                            <h:commandButton  id="viewdialog" value="просмотреть" action="#{messageBean.viewDialog}" actionListener="#{messageBean.curMessList}">
                                    <f:attribute name="curentMess" value="#{o}"/>
                                </h:commandButton>
                            </h:form>
                        </h:column>
                        
                    </h:dataTable>
                </c:if> 
            </ui:define>
        </ui:composition>
            
</h:body>

</html>